<template>
    <div>
        <el-input-number class="r5" :max="max" :min="min" v-model="number"/>
        <span style="color:#999999;">(最小值：{{min}}，最大值：{{max}})</span>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                min: 0,
                max: 0,
            }
        },
        props: {
            value: {
                default: '0'
            },
            limit: {
                type: String,
                default: '0,100'
            }
        },
        model: {
            prop: 'value'
        },
        created() {
            let limit = this.limit.split(',');
            this.min = parseInt(limit[0]);
            this.max = parseInt(limit[1]);
        },
        computed: {
            number: {
                get() {
                    return parseInt(this.value);
                },
                set(val) {
                    this.$emit('input', val + '');
                }
            }
        }
    }
</script>
